A dialog hook function handles user selections in a dialog box. A custom dialog function lets you support the template in the custom dialog template that you specified with the CustomGetFilePreview routine. This function corresponds to the File Manager's CustomGetFile routine. See Inside Macintosh: Files for a complete description of the CustomGetFile routine.
You specify your dialog function in the dlgHook parameter of CustomGetFilePreview . You can use this parameter to support a custom dialog box function you have supplied by specifying a dialog template resource in your resource file. You specify the dialog template's resource ID with the dlgID parameter. If you are not supplying a custom dialog function, set this parameter to nil . For more information about using custom dialog functions with the CustomGetFile routine, see Inside Macintosh: Files.
A dialog hook function should have the following form:
pascal short MyDlgHook (short item, DialogPtr theDialog,
Ptr myDataPtr);
You supply a dialog hook function to handle user selections of items that you added to a dialog box. If you provide a dialog hook function, CustomGetFilePreview calls your function immediately after calling the Dialog Manager's ModalDialog function. It passes your function the item number returned by ModalDialog , a pointer to the dialog structure, and a pointer to the data received from your application, if any.
Your dialog hook function returns as its function result an integer that is either the item number passed to it or some other item number. If your dialog hook function does not handle a selection, it should pass the item number back to the Standard File Package for processing by setting its return value equal to the item number. If your dialog hook function does handle the selection, it should pass back sfHookNullEvent or the number of some other pseudo-item.